﻿using System;
using System.Collections.Generic;
using System.Text;
using AgencyManagerSystem.Model;
using AgencyManagerSystem.Common;
using Dapper;
using System.Linq;

namespace AgencyManagerSystem.DataFetcher
{
    public class RoleFetcher : BaseFetcher<RoleModel>
    {
        public RoleFetcher() : base()
        {

        }
        public RoleModel GetByCode(string code)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Code", Op = "=", Value = code } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            else
                return null;
        }
    }
}
